from ui_auto.public.utils.api_build import Base_Api
from ddt import ddt,data,unpack
from ui_auto.public.utils.get_excel_value import get_value
import os
from ui_auto.config.config import data_path
import json
file=os.path.join(data_path,'cms_api.xls')
@ddt()
class  Test_Login(Base_Api):
    @classmethod
    def setUpClass(cls) -> None:
        Base_Api.set_session()
    @data(*get_value(file_name=file,sheet_name="ea_login"))
    @unpack
    def test001_login(self,method,url,data,headers,exception):
        A=Base_Api.get_session()
        a=A.request(method=method,
                    url=url,
                    data=json.loads(data),
                    headers=json.loads(headers))
        assert a.json()==json.loads(exception)
if __name__ == '__main__':
    import unittest
    unittest.main()